package com.ssyc.student.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.widget.TextView;

import com.ssyc.common.adapter.CommonAdapter;
import com.ssyc.common.adapter.ViewHolder;
import com.ssyc.student.R;
import com.ssyc.student.bean.ChooseAnswerInfo;

import java.util.List;

/**
 * 学生端--阅读--展示选择题目状态的列表适配器
 * Created by Administrator on 2018/5/10 0010.
 */

public class StRvChooseAnswerAdapter extends CommonAdapter<ChooseAnswerInfo> {
    private Context context;

    public StRvChooseAnswerAdapter(Context context, List<ChooseAnswerInfo> datas, int layoutId) {
        super(context, datas, layoutId);
        this.context = context;
    }

    @Override
    public void convert(ViewHolder holder, ChooseAnswerInfo chooseAnswerInfo) {

        TextView tv = holder.getView(R.id.tv);

        tv.setText(chooseAnswerInfo.answerIndex + "");

        if (!TextUtils.isEmpty(chooseAnswerInfo.answerFlag)) {
            //证明没做题
            tv.setBackgroundResource(R.drawable.st_tv_choose_answer_select);
        } else {
            tv.setBackgroundResource(R.drawable.st_tv_choose_answer_normal);
        }
    }
}
